Skip to content

Refactor Logger#773

Draft
stevenzeck wants to merge 1 commit into
readium:swift6from
stevenzeck:refactor/logger
Draft

Refactor Logger#773
stevenzeck wants to merge 1 commit into
readium:swift6from
stevenzeck:refactor/logger

Conversation

@stevenzeck
Copy link
Copy Markdown
Contributor

@stevenzeck stevenzeck commented Apr 12, 2026

Refactored Logger to be Swift 6 compliant.

Public API Breaking Changes

  1. LoggerType.log signature changed: The value parameter type was changed from Any? to String?.
    • Old: func log(level: SeverityLevel, value: Any?, file: String, line: Int)
    • New: func log(level: SeverityLevel, value: String?, file: String, line: Int)

Related to #758.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Shared logging subsystem for Swift 6 strict-concurrency compliance by moving the singleton Logger to an actor and updating the logging pipeline to avoid cross-thread shared-state violations.

Changes:

  • Converted Logger from a final class singleton to an actor, and updated ReadiumEnableLog to configure it asynchronously.
  • Updated LoggerType.log to accept String? (instead of Any?) and made LoggerType Sendable.
  • Updated Loggable default implementations to convert Any? to String? and perform fire-and-forget logging via Task.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Sources/Shared/Logger/Logger.swift Converts the singleton logger to an actor; updates public configuration entrypoint and logger protocol for Swift 6 concurrency.
Sources/Shared/Logger/Loggable.swift Wraps logging calls in Task and converts logged values to String? to match the new LoggerType API.
Sources/Shared/Logger/LoggerStub.swift Updates the stub logger to the new LoggerType.log signature and prints the provided string message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/Shared/Logger/Logger.swift Outdated
Comment thread Sources/Shared/Logger/Logger.swift Outdated
Comment thread Sources/Shared/Logger/Loggable.swift Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants